﻿/*
 * You have to produce the following output by appropriately instantiating the available classes: 
 * "Never send a human to do a machine's job."
 */

using System;

namespace HomeTask02
{
    #region The available classes

    public interface IWord
    {
        void Print();
    }

    public interface IWord2 : IWord
    {
        new void Print();
    }

    public abstract class Base
    {
        protected static string msg = "send ";

        public Base()
        {
            Console.Write(this.GetString());
        }

        static Base()
        {
            Console.Write("Never ");
        }

        public virtual void Print()
        {
            Console.Write("to ");
        }

        protected virtual string GetString()
        {
            return "llama ";
        }
    }

    public class Derived : Base, IWord
    {

        static Derived()
        {
            Console.Write(Derived.msg);
        }

        public new virtual void Print()
        {
            Console.Write("do ");
        }

        protected override string GetString()
        {
            return "a ";
        }
    }

    public sealed class MoreDerived : Derived, IWord
    {
        public override void Print()
        {
            Console.Write("mach");
        }

        void IWord.Print()
        {
            Console.Write("a ");
        }

        protected override string GetString()
        {
            return "do ";
        }
    }

    public sealed class MoreDerived2 : Derived, IWord2
    {

        static MoreDerived2()
        {
            Console.Write("ine");
        }

        public new void Print()
        {
            Console.Write("job. ");
        }

        void IWord2.Print()
        {
            Console.Write("job.");
        }

        protected override string GetString()
        {
            return "'s ";
        }
    }

    public abstract class Unfinished : Base
    {
        protected new void Print()
        {
            Console.Write("camel ");
        }

        protected override string GetString()
        {
            return "human ";
        }
    }

    public class Finished : Unfinished
    {
    }

    #endregion

    class Program
    {

        public static void Main()
        {

            Derived obj11 = new Derived();//static Base - "Never"; static Derived - Derived.msg=="send"; public Base calls Derived's GetString with "a "
            Finished obj311 = new Finished();//public Base calls Unfinished's GetString with "human "
            obj311.Print();//Base.Print - "to"
            Derived ob = new MoreDerived();//public Base calls MoreDerivedss GetString with "do "
            Derived obb = new Derived();//public Base calls Derived's GetString with "a "
            ob.Print();//MoreDerived.Print - "mach"
            MoreDerived2 obj2 = new MoreDerived2();//static MoreDerived2 - "ine"; public Base calls MoreDerived2's GetString with "'s "
            obj2.Print();//MoreDerived2.Print " job."

            Console.WriteLine(); 


            Console.WriteLine("Never send a human to do a machine's job.");
            Console.ReadLine();
        }
    }
}
